/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.vetor.model.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Moises.Moura
 */
@Entity
@Table(name = "acesso", catalog = "dbvetor", schema = "")
@NamedQueries({
    @NamedQuery(name = "Acesso.findAll", query = "SELECT a FROM Acesso a"),
    @NamedQuery(name = "Acesso.findByCodigo", query = "SELECT a FROM Acesso a WHERE a.codigo = :codigo"),
    @NamedQuery(name = "Acesso.findByLogin", query = "SELECT a FROM Acesso a WHERE a.login = :login"),
    @NamedQuery(name = "Acesso.findBySenha", query = "SELECT a FROM Acesso a WHERE a.senha = :senha")})
public class Acesso implements Serializable {
    
    /**
	 * 
	 */
	private static final long serialVersionUID = -6040097345875113347L;
	@Id
    @Basic(optional = false)
    @Column(name = "codigo", nullable = false)
    private Integer codigo;
    
	@Basic(optional = false)
    @Column(name = "login", nullable = false, length = 60)
    private String login;
    
	@Basic(optional = false)
    @Column(name = "senha", nullable = false, length = 10)
    private String senha;
    
	@OneToMany(cascade = CascadeType.ALL, mappedBy = "acesso")
    private List<Funcionario> funcionarioList;

    public Acesso() {
    }

    public Acesso(Integer codigo) {
        this.codigo = codigo;
    }

    public Acesso(Integer codigo, String login, String senha) {
        this.codigo = codigo;
        this.login = login;
        this.senha = senha;
    }

    public Integer getCodigo() {
        return codigo;
    }

    public void setCodigo(Integer codigo) {
        this.codigo = codigo;
    }

    public String getLogin() {
        return login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getSenha() {
        return senha;
    }

    public void setSenha(String senha) {
        this.senha = senha;
    }

    public List<Funcionario> getFuncionarioList() {
        return funcionarioList;
    }

    public void setFuncionarioList(List<Funcionario> funcionarioList) {
        this.funcionarioList = funcionarioList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codigo != null ? codigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Acesso)) {
            return false;
        }
        Acesso other = (Acesso) object;
        if ((this.codigo == null && other.codigo != null) || (this.codigo != null && !this.codigo.equals(other.codigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidadesvetor.Acesso[codigo=" + codigo + "]";
    }

}
